<?php

/**
 * DoctorShow form.
 *
 * @package    docplus.co.za
 * @subpackage form
 * @author     Fox Matuku
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class DoctorShowForm extends BaseDoctorShowForm
{

    public function configure()
    {
        unset(
            $this['created_at'], $this['updated_at']
        );

        //gfToolkit::debug($this->getObject()->toArray());

        if (!$this->getObject()->getDoctorId())
        {
            throw new InvalidArgumentException('You must provide a doctor object.');
        }

        $this->widgetSchema['doctor_id'] = new sfWidgetFormInputHidden();
        $this->widgetSchema['photo'] = new sfWidgetFormInputFile();

        $this->setValidator('photo', new sfValidatorFile(array(
                'required' => $this->isNew(),
                'mime_types' => 'web_images',
                'validated_file_class' => 'gfValidatedPhoto',
                'path' => sfConfig::get('sf_upload_dir') . '/doctors/' . $this->getObject()->getDoctorId() . '/',
                ), array('required' => 'Please specify a <b>Photo</b> to upload.')
        ));
    }

}
